﻿package mortal.game.view.copy.ChallengeCopy.newView
{
    import com.mui.controls.*;
    import mortal.game.view.common.*;

    public class AvatarBox extends GSprite
    {
        private var _avatar:GImageBitmap;
        private var _bg:GImageBitmap;

        public function AvatarBox()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bg = UIFactory.gImageBitmap("", 0, 0, this, this.resetPos);
            this._avatar = UIFactory.gImageBitmap("", 0, 0, this, this.resetPos);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._avatar.dispose(param1);
            this._avatar = null;
            this._bg.dispose(param1);
            this._bg = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function resetPos() : void
        {
            if (this._avatar && this._bg)
            {
                this._avatar.x = (this._bg.width - this._avatar.width) * 0.5;
                this._avatar.y = (this._bg.height - this._avatar.height) * 0.5;
            }
            return;
        }// end function

        public function set avatarUrl(param1:String) : void
        {
            this._avatar.imgUrl = param1;
            return;
        }// end function

        public function set bgUrl(param1:String) : void
        {
            this._bg.imgUrl = param1;
            return;
        }// end function

    }
}
